﻿
Namespace PL.MESSDK
    Public Class MRPMasterPlan_PL
        Inherits PLBase

        Public Sub New()
            MyBase.New()
        End Sub

        Public Sub New(ByVal queryName As String)
            MyBase.New(queryName)
        End Sub

        Public Overrides Sub ValidateRow(row As DataRow)
            row.ClearErrors()
            'Mandatory Fields
            'TODO: Cache MetaString in AppManager, so here we read it once maybe for nothing
            'Dim ms As MetaString
            'ms = MetaString.GetMetaStringByCode("Mandatory", AppManager.ApplicationOption.LanguageId)
            If IsDBNull(row("ID")) Then
                row.SetColumnError("ID", "Mandatory")
            End If
            If IsDBNull(row("MRPID_FK")) Then
                row.SetColumnError("MRPID_FK", "Mandatory")
            End If
            If IsDBNull(row("ProductID_FK")) Then
                row.SetColumnError("ProductID_FK", "Mandatory")
            End If
            If IsDBNull(row("Offload")) Then
                row.SetColumnError("Offload", "Mandatory")
            End If
            If IsDBNull(row("MRPID_FK")) Then
                row.SetColumnError("MRPID_FK", "Mandatory")
            End If

            If row.HasErrors Then
                row.RowError = "Please check your columns, a validation error occur"
            End If
        End Sub

        Public Overrides Function Delete() As Boolean
            'Throw New NotImplementedException("Delete To Come...")
            Return False
        End Function

        Public Overrides Function Validate() As Boolean
            'Throw New NotImplementedException("Validate To Come...")
            Return True
        End Function
    End Class
	End Namespace
